#14、使用python实现5行5列的盘龙数组
import re
def lst1(lst):
    for i in lst:
        print(re.sub(r"\W", "\t", str(i)), "\n")

def func(n):
    lst = []
    num = 2
    l = 0
    j = 0
    for i in range(n):
        lst.append([0] * n)
    lst[0][0] = 1
    while j < n - 1:
        j = j + 1
        lst[l][j] = num
        num = num + 1
    while n > 0:
        if n/2:
            for _ in range(n-1):
                l = l + 1
                lst[l][j] = num
                num = num + 1
            for _ in range(n-1):
                j = j - 1
                lst[l][j] = num
                num = num + 1
            n = n - 1
        if n != 0:
            for _ in range(n-1):
                l = l - 1
                lst[l][j] = num
                num = num + 1
            for _ in range(n-1):
                j = j + 1
                lst[l][j] = num
                num = num + 1
            n = n - 1
    lst1(lst)
func(5)
